import { formatTimeTwo } from '../../../utils/util'

Component({
  properties: {
    show: {
      type: Boolean,
      value: false
    }
  },
  data: {
    minDate: new Date().getTime() - (5 * 365 * 24 * 60 * 60 * 1000)
  },
  methods: {
    onClose () {
      this.triggerEvent('close')
    },
    onConfirm ({ detail }) {
      let startTime = formatTimeTwo(detail[0], 'Y-M-D')
      let endTime = formatTimeTwo(detail[1], 'Y-M-D')
      let times = [startTime, endTime]
      this.triggerEvent('change', times)
    }
  },
})